/**
 * BeautifyData.java
 */
package com.pluginsacceptor.plugin.beautify.model;

import java.util.ArrayList;
import java.util.List;

/**
 * The class contains last active data for changes
 */
public class CellList {

    /** */
    private final List<Integer> rows = new ArrayList<Integer>();

    /** */
    private final List<Integer> columns = new ArrayList<Integer>();


    /**
     * Added beautify data item
     * @param row the row item
     * @param column the column item
     */
    public void add(final Integer row, final Integer column) {
        this.rows.add(row);
        this.columns.add(column);
    }

    /**
     * Clear all data
     */
    public void clear() {
        this.rows.clear();
        this.columns.clear();
    }

    /**
     * @return the rows
     */
    public List<Integer> getRows() {
        return rows;
    }

    /**
     * @return the columns
     */
    public List<Integer> getColumns() {
        return columns;
    }

    /**
     * @param row the row item
     * @param column the column item
     * @return <code>true</code> if cell with row and col contains in cell list
     */
    public boolean contains(final Integer row, final Integer col) {
        final int index = this.rows.indexOf(row);
        return index == -1 ? false : this.columns.get(index).equals(col);
    }

}
